

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>为块设备安装虚拟化支持 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/underscore.js"></script>
        <script src="../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="手动部署" href="../manual-deployment/" />
    <link rel="prev" title="安装 Ceph 存储集群" href="../install-storage-cluster/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../">安装 Ceph</a> &raquo;</li>
        
          <li><a href="../index_manual/">安装（手动）</a> &raquo;</li>
        
      <li>为块设备安装虚拟化支持</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../_sources/install/install-vm-cloud.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../">
          

          
            
            <img src="../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">安装 Ceph</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../#id1">建议的方法</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../#id2">其他方法</a><ul class="current">
<li class="toctree-l3 current"><a class="reference internal" href="../index_manual/">安装（手动）</a><ul class="current">
<li class="toctree-l4"><a class="reference internal" href="../index_manual/#id2">获取软件</a></li>
<li class="toctree-l4 current"><a class="reference internal" href="../index_manual/#id3">安装软件</a></li>
<li class="toctree-l4"><a class="reference internal" href="../index_manual/#id4">手动部署一套集群</a></li>
<li class="toctree-l4"><a class="reference internal" href="../index_manual/#id5">升级软件</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../#windows">Windows</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="id1">
<h1>为块设备安装虚拟化支持<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h1>
<p>如果你想使用 Ceph 块设备、还想把 Ceph 存储集群作为虚拟机（ VM ）或 <a class="reference internal" href="../../glossary/#term-19"><span class="xref std std-term">云平台</span></a> 的后端，
QEMU/KVM 和 <code class="docutils literal notranslate"><span class="pre">libvirt</span></code> 软件包对于 VM 和云平台的实现很重要。
VM 的具体实现有： QEMU/KVM, XEN, VMWare, LXC, VirtualBox 等等。
云平台的具体实现有： OpenStack 、 CloudStack 、 OpenNebula 等等。</p>
<div class="section" id="qemu">
<h2>安装 QEMU<a class="headerlink" href="#qemu" title="Permalink to this headline">¶</a></h2>
<p>QEMU KVM 能通过 <code class="docutils literal notranslate"><span class="pre">librbd</span></code> 库使用 Ceph 块设备，这对云平台是否能采用 Ceph 来说很重要。装好 QEMU 后，可以参考 <a class="reference external" href="../../rbd/qemu-rbd">QEMU 和块设备</a>把它用起来。</p>
<div class="section" id="debian">
<h3>Debian 软件包<a class="headerlink" href="#debian" title="Permalink to this headline">¶</a></h3>
<p>QEMU 二进制包从 Ubuntu 12.04 Precise Pangolin 版起就被合并到了 Ubuntu 官方库。执行下面的命令安装 QEMU ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">apt</span><span class="o">-</span><span class="n">get</span> <span class="n">install</span> <span class="n">qemu</span>
</pre></div>
</div>
</div>
<div class="section" id="rpm">
<h3>RPM 软件包<a class="headerlink" href="#rpm" title="Permalink to this headline">¶</a></h3>
<p>要安装 QEMU ，可按如下步骤：</p>
<ol class="arabic">
<li><p>更新软件库：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">yum</span> <span class="n">update</span>
</pre></div>
</div>
</li>
<li><p>安装能和 Ceph 对接的 QEMU ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">yum</span> <span class="n">install</span> <span class="n">qemu</span><span class="o">-</span><span class="n">kvm</span> <span class="n">qemu</span><span class="o">-</span><span class="n">kvm</span><span class="o">-</span><span class="n">tools</span> <span class="n">qemu</span><span class="o">-</span><span class="n">img</span>
</pre></div>
</div>
</li>
<li><p>安装其它的 QEMU 软件包（可选的）：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">yum</span> <span class="n">install</span> <span class="n">qemu</span><span class="o">-</span><span class="n">guest</span><span class="o">-</span><span class="n">agent</span> <span class="n">qemu</span><span class="o">-</span><span class="n">guest</span><span class="o">-</span><span class="n">agent</span><span class="o">-</span><span class="n">win32</span>
</pre></div>
</div>
</li>
</ol>
</div>
<div class="section" id="id2">
<h3>构建 QEMU<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h3>
<p>要从源码构建 QEMU ，按下列步骤：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">cd</span> <span class="p">{</span><span class="n">your</span><span class="o">-</span><span class="n">development</span><span class="o">-</span><span class="n">directory</span><span class="p">}</span>
<span class="n">git</span> <span class="n">clone</span> <span class="n">git</span><span class="p">:</span><span class="o">//</span><span class="n">git</span><span class="o">.</span><span class="n">qemu</span><span class="o">.</span><span class="n">org</span><span class="o">/</span><span class="n">qemu</span><span class="o">.</span><span class="n">git</span>
<span class="n">cd</span> <span class="n">qemu</span>
<span class="o">./</span><span class="n">configure</span> <span class="o">--</span><span class="n">enable</span><span class="o">-</span><span class="n">rbd</span>
<span class="n">make</span><span class="p">;</span> <span class="n">make</span> <span class="n">install</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="libvirt">
<h2>安装 libvirt<a class="headerlink" href="#libvirt" title="Permalink to this headline">¶</a></h2>
<p>要在 Ceph 上使用 <code class="docutils literal notranslate"><span class="pre">libvirt</span></code> ，你必须有正常运行的 Ceph 存储集群、
还必须安装并配置好 QEMU 。
用法见 <a class="reference external" href="../../rbd/libvirt">在 libvirt 上使用 Ceph 块设备</a> 。</p>
<div class="section" id="id3">
<h3>Debian 软件包<a class="headerlink" href="#id3" title="Permalink to this headline">¶</a></h3>
<p><code class="docutils literal notranslate"><span class="pre">libvirt</span></code> 软件包从 Ubuntu 12.04 Precise Pangolin 起就被并入了 Ubuntu 官方库。要在这些发行版上安装 <code class="docutils literal notranslate"><span class="pre">libvirt</span></code> ，可用下面的命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">apt</span><span class="o">-</span><span class="n">get</span> <span class="n">update</span> <span class="o">&amp;&amp;</span> <span class="n">sudo</span> <span class="n">apt</span><span class="o">-</span><span class="n">get</span> <span class="n">install</span> <span class="n">libvirt</span><span class="o">-</span><span class="nb">bin</span>
</pre></div>
</div>
</div>
<div class="section" id="id4">
<h3>RPM 软件包<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h3>
<p>要通过 <code class="docutils literal notranslate"><span class="pre">libvirt</span></code> 使用 Ceph 存储集群，你必须有个正常运行的 Ceph 集群、还必须安装支持 <code class="docutils literal notranslate"><span class="pre">rbd</span></code> 格式的 QEMU 。详情见 <a class="reference internal" href="#qemu">安装 QEMU</a> 。</p>
<p>近期的 CentOS/RHEL 发行版都集成了 <code class="docutils literal notranslate"><span class="pre">libvirt</span></code> 软件包。可执行如下命令安装 <code class="docutils literal notranslate"><span class="pre">libvirt</span></code> ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">sudo</span> <span class="n">yum</span> <span class="n">install</span> <span class="n">libvirt</span>
</pre></div>
</div>
</div>
<div class="section" id="id5">
<h3>构建 <code class="docutils literal notranslate"><span class="pre">libvirt</span></code><a class="headerlink" href="#id5" title="Permalink to this headline">¶</a></h3>
<p>要从源码构建 <code class="docutils literal notranslate"><span class="pre">libvirt</span></code> ，需要克隆 <code class="docutils literal notranslate"><span class="pre">libvirt</span></code> 软件库，
然后用 <a class="reference external" href="http://www.gnu.org/software/autogen/">AutoGen</a> 生成构建文件。然后执行 <code class="docutils literal notranslate"><span class="pre">make</span></code> 和 <code class="docutils literal notranslate"><span class="pre">make</span> <span class="pre">install</span></code>
完成安装。例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">git</span> <span class="n">clone</span> <span class="n">git</span><span class="p">:</span><span class="o">//</span><span class="n">libvirt</span><span class="o">.</span><span class="n">org</span><span class="o">/</span><span class="n">libvirt</span><span class="o">.</span><span class="n">git</span>
<span class="n">cd</span> <span class="n">libvirt</span>
<span class="o">./</span><span class="n">autogen</span><span class="o">.</span><span class="n">sh</span>
<span class="n">make</span>
<span class="n">sudo</span> <span class="n">make</span> <span class="n">install</span>
</pre></div>
</div>
<p>详情见 <a class="reference external" href="http://www.libvirt.org/compiling.html">libvirt 安装手册</a>。</p>
</div>
</div>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../manual-deployment/" class="btn btn-neutral float-right" title="手动部署" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../install-storage-cluster/" class="btn btn-neutral float-left" title="安装 Ceph 存储集群" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>